<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>EOS.IO: EOS Command Line Client (eosc)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="eos-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">EOS.IO
   &#160;<span id="projectnumber">DAWN1.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">EOS Command Line Client (eosc)</div>  </div>
</div><!--header-->
<div class="contents">

<p>Tool for sending transactions and querying state from eosd.  
<a href="#details">More...</a></p>
<h1><a class="anchor" id="contents"></a>
Table of Contents</h1>
<ul>
<li><a href="#intro">Introduction to EOSC</a></li>
<li><a href="#createwallet">Creating a Wallet</a></li>
<li><a href="#importkey">Importing Key to Wallet</a></li>
<li><a href="#lockwallet">Locking and Unlocking Wallet</a></li>
<li><a href="#openwallet">Opening Wallet</a></li>
<li><a href="#createaccount">Creating an Account</a></li>
<li><a href="#transfereos">Transfer EOS</a></li>
<li><a href="#gettingtransaction">Getting Transaction</a></li>
<li><a href="#createcontract">Creating a Contract</a></li>
<li><a href="#pushmessage">Pushing Message to Contract</a></li>
<li><a href="#querycontract">Querying Contract</a></li>
<li><a href="#particularnode">Connecting to Particular Node</a></li>
<li><a href="#separatewallet">Using Separate Wallet App</a></li>
<li><a href="#skippingsignature">Skipping Signature</a></li>
<li><a href="#additionaldocumentation">Additional Documentation</a></li>
</ul>
<h1><a class="anchor" id="intro"></a>
Introduction to EOS Wallet Process</h1>
<p><code>eosc</code> is a command line tool that interfaces with the REST api exposed by eosd. In order to use <code>eosc</code> you will need to have a local copy of <code>eosd</code> running and configured to load the 'eosio::chain_api_plugin'.</p>
<p>In order to sign transaction and push it to the blockchain, you will need to have the 'eosio::wallet_api_plugin' loaded.</p>
<p>And in order to query account history and transaction, you will need to have the 'eosio::account_history_api_plugin' loaded. </p><div class="fragment"><div class="line"><span class="preprocessor"># Plugin(s) to enable, may be specified multiple times</span></div><div class="line"> plugin = eosio::producer_plugin</div><div class="line"> plugin = eosio::chain_api_plugin</div><div class="line"> plugin = eosio::wallet_api_plugin</div><div class="line"> plugin = eosio::account_history_api_plugin</div></div><!-- fragment --><p>After starting <code>eosd</code> you should be able to query the current blockchain state like so:</p>
<div class="fragment"><div class="line">$ ./eosc <span class="keyword">get</span> info</div><div class="line">{</div><div class="line"> <span class="stringliteral">&quot;head_block_num&quot;</span>: 25048,</div><div class="line"> <span class="stringliteral">&quot;last_irreversible_block_num&quot;</span>: 25027,</div><div class="line"> <span class="stringliteral">&quot;head_block_id&quot;</span>: <span class="stringliteral">&quot;000061d8ae49d6af614e02779e19261959f22d6d9f37906ed5db2dabd88be142&quot;</span>,</div><div class="line"> <span class="stringliteral">&quot;head_block_time&quot;</span>: <span class="stringliteral">&quot;2017-07-25T17:44:48&quot;</span>,</div><div class="line"> <span class="stringliteral">&quot;head_block_producer&quot;</span>: <span class="stringliteral">&quot;initi&quot;</span>,</div><div class="line"> <span class="stringliteral">&quot;recent_slots&quot;</span>: <span class="stringliteral">&quot;1110000000000000000000000000000000000000000000000000000000000011&quot;</span>,</div><div class="line"> <span class="stringliteral">&quot;participation_rate&quot;</span>: <span class="stringliteral">&quot;0.07812500000000000&quot;</span></div><div class="line">}</div></div><!-- fragment --><h1><a class="anchor" id="createwallet"></a>
Creating a Wallet</h1>
<p>Any transaction sent to the blockchain will need to be signed by the respective authority's private key. Before you will be able to sign the transaction, you will need a wallet to store and manage the private key. </p><div class="fragment"><div class="line">$ ./eosc wallet create</div><div class="line">Creating wallet: <span class="keywordflow">default</span></div><div class="line">Save password to use in the future to unlock <span class="keyword">this</span> wallet.</div><div class="line">Without password imported keys will not be retrievable.</div><div class="line"><span class="stringliteral">&quot;PW5JD9cw9YY288AXPvnbwUk5JK4Cy6YyZ83wzHcshu8F2akU9rRWE&quot;</span></div></div><!-- fragment --><p> This will create a wallet called 'default' inside <code>eos-walletd</code> and return a password that you can use to unlock your wallet in the future.</p>
<p>You can create multiple wallets by specifying unique name </p><div class="fragment"><div class="line">$ ./eosc wallet create -n second-wallet</div><div class="line">Creating wallet: second-wallet</div><div class="line">Save password to use in the future to unlock <span class="keyword">this</span> wallet.</div><div class="line">Without password imported keys will not be retrievable.</div><div class="line"><span class="stringliteral">&quot;PW5Ji6JUrLjhKAVn68nmacLxwhvtqUAV18J7iycZppsPKeoGGgBEw&quot;</span></div></div><!-- fragment --><p>And you will be see it in the list of your wallets </p><div class="fragment"><div class="line">$ ./eosc wallet list</div><div class="line">Wallets:</div><div class="line">[</div><div class="line">  <span class="stringliteral">&quot;default *&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;second-wallet *&quot;</span></div><div class="line">]</div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>For any wallet operation, if you don't specify the name of the wallet, it will always resort to <code>default</code> wallet</dd></dl>
<h1><a class="anchor" id="importkey"></a>
Importing Key to Wallet</h1>
<p>Import the key that you want to use to sign the transaction to your wallet. The following will import key for genesis accounts (i.e. inita, initb, initc, ..., initu) </p><div class="fragment"><div class="line">$ ./eosc wallet <span class="keyword">import</span> 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3</div><div class="line">imported <span class="keyword">private</span> key <span class="keywordflow">for</span>: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV</div></div><!-- fragment --><p> You will then be able to see the list of imported private keys and their respective public key </p><div class="fragment"><div class="line">$ ./eosc wallet keys</div><div class="line">[[</div><div class="line">    <span class="stringliteral">&quot;EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3&quot;</span></div><div class="line">  ]</div><div class="line">]</div></div><!-- fragment --><h1><a class="anchor" id="lockwallet"></a>
Locking and Unlocking Wallet</h1>
<p>To keep your private key safe, lock your wallet </p><div class="fragment"><div class="line">$ ./eosc wallet lock -n second-wallet</div><div class="line">Locked: <span class="stringliteral">&#39;second-wallet&#39;</span></div></div><!-- fragment --><p> Notice that the locked wallet doesn't have * symbol in the list </p><div class="fragment"><div class="line">$ ./eosc wallet list</div><div class="line">Wallets:</div><div class="line">[</div><div class="line">  <span class="stringliteral">&quot;default *&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;second-wallet&quot;</span></div><div class="line">]</div></div><!-- fragment --><p> To unlock it specify the password you get when creating the wallet </p><div class="fragment"><div class="line">$ ./eosc wallet unlock -n second-wallet --password PW5Ji6JUrLjhKAVn68nmacLxwhvtqUAV18J7iycZppsPKeoGGgBEw</div><div class="line">Unlocked: <span class="stringliteral">&#39;second-wallet&#39;</span></div></div><!-- fragment --><h1><a class="anchor" id="openwallet"></a>
Opening Wallet</h1>
<p>All of the wallets data are store inside data_dir folder. When you restart your wallet app (in this case <code>eosd</code>), you will need to open the wallet so <code>eosc</code> can have access to it. </p><div class="fragment"><div class="line">$ ./eosc wallet list</div><div class="line">Wallets: []</div><div class="line">$ ./eosc wallet open</div><div class="line">Wallets: [</div><div class="line">  <span class="stringliteral">&quot;default&quot;</span></div><div class="line">]</div><div class="line">$ ./eosc wallet open -n second-wallet</div><div class="line">Wallets: [</div><div class="line">  <span class="stringliteral">&quot;default&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;second-wallet&quot;</span></div><div class="line">]</div></div><!-- fragment --> <dl class="section note"><dt>Note</dt><dd>The wallet is locked by default</dd></dl>
<h1><a class="anchor" id="createaccount"></a>
Creating an Account</h1>
<p>In order to create an account you will need two new keys: owner and active. You can ask <code>eosc</code> to create some keys for you:</p>
<p>This will be your owner key, </p><div class="fragment"><div class="line">$ ./eosc create key</div><div class="line"><span class="keyword">public</span>: EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq</div><div class="line"><span class="keyword">private</span>: 5JKbLfCXgcafDQVwHMm3shHt6iRWgrr9adcmt6vX3FNjAEtJGaT</div></div><!-- fragment --><p>And this will be your active key, </p><div class="fragment"><div class="line">$ ./eosc create key</div><div class="line"><span class="keyword">public</span>: EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA</div><div class="line"><span class="keyword">private</span>: 5Hv22aPcjnENBv6X9o9nKGdkfrW44En6z4zJUt2PobAvbQXrT9z</div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>eosc does not save the generated private key.</dd></dl>
<p>Next we will create the account <code>tester</code>, but because all accounts need to be created by an existing account we will ask the <code>inita</code> account to create <code>tester</code> using the owner and active keys created above. <code>inita</code> was specified in the genesis file.</p>
<p>In order to push transaction as <code>inita</code>, you first need to <a href="#importkey">import inita's private key to your wallet</a></p>
<p>Then create an account called tester </p><div class="fragment"><div class="line">$ ./eosc create account inita tester EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;transaction_id&quot;</span>: <span class="stringliteral">&quot;6acd2ece68c4b86c1fa209c3989235063384020781f2c67bbb80bc8d540ca120&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;processed&quot;</span>: {</div><div class="line">    <span class="stringliteral">&quot;refBlockNum&quot;</span>: <span class="stringliteral">&quot;25217&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;refBlockPrefix&quot;</span>: <span class="stringliteral">&quot;2095475630&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;expiration&quot;</span>: <span class="stringliteral">&quot;2017-07-25T17:54:55&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;scope&quot;</span>: [</div><div class="line">      <span class="stringliteral">&quot;eos&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;inita&quot;</span></div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;signatures&quot;</span>: [],</div><div class="line">    <span class="stringliteral">&quot;messages&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;code&quot;</span>: <span class="stringliteral">&quot;eos&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;newaccount&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;authorization&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;account&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;permission&quot;</span>: <span class="stringliteral">&quot;active&quot;</span></div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;data&quot;</span>: <span class="stringliteral">&quot;c9251a0000000000b44c5a2400000000010000000102bcca6347d828d4e1868b7dfa91692a16d5b20d0ee3d16a7ca2ddcc7f6dd03344010000010000000102bcca6347d828d4e1868b7dfa91692a16d5b20d0ee3d16a7ca2ddcc7f6dd03344010000010000000001c9251a000000000061d0640b000000000100010000000000000008454f5300000000&quot;</span></div><div class="line">      }</div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;output&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">        <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">        <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">      }</div><div class="line">    ]</div><div class="line">  }</div><div class="line">}</div></div><!-- fragment --><p> You can see that <code>tester</code> is now the controlled_account under <code>inita</code> </p><div class="fragment"><div class="line">$ ./eosc <span class="keyword">get</span> servants inita</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;controlled_accounts&quot;</span>: [</div><div class="line">    <span class="stringliteral">&quot;tester&quot;</span></div><div class="line">  ]</div><div class="line">}</div></div><!-- fragment --><h1><a class="anchor" id="transfereos"></a>
Transfer EOS</h1>
<p>After creating the account we can view the current account status like so:</p>
<div class="fragment"><div class="line">$ ./eosc <span class="keyword">get</span> account tester</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;eos_balance&quot;</span>: 0,</div><div class="line">  <span class="stringliteral">&quot;staked_balance&quot;</span>: 1,</div><div class="line">  <span class="stringliteral">&quot;unstaking_balance&quot;</span>: 0,</div><div class="line">  <span class="stringliteral">&quot;last_unstaking_time&quot;</span>: <span class="stringliteral">&quot;1969-12-31T23:59:59&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;permissions&quot;</span>: [{</div><div class="line">      <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;active&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;parent&quot;</span>: <span class="stringliteral">&quot;owner&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;required_auth&quot;</span>: {</div><div class="line">        <span class="stringliteral">&quot;threshold&quot;</span>: 1,</div><div class="line">        <span class="stringliteral">&quot;keys&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;key&quot;</span>: <span class="stringliteral">&quot;EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;weight&quot;</span>: 1</div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;accounts&quot;</span>: []</div><div class="line">      }</div><div class="line">    },{</div><div class="line">      <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;owner&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;parent&quot;</span>: <span class="stringliteral">&quot;owner&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;required_auth&quot;</span>: {</div><div class="line">        <span class="stringliteral">&quot;threshold&quot;</span>: 1,</div><div class="line">        <span class="stringliteral">&quot;keys&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;key&quot;</span>: <span class="stringliteral">&quot;EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;weight&quot;</span>: 1</div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;accounts&quot;</span>: []</div><div class="line">      }</div><div class="line">    }</div><div class="line">  ]</div><div class="line">}</div></div><!-- fragment --><p>You will note that there is no balance because almost all genesis EOS tokens are currently allocated to the <code>eos</code> account and genesis accounts.</p>
<div class="fragment"><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;eos&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;eos_balance&quot;</span>: <span class="stringliteral">&quot;69000000.0000 EOS&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;staked_balance&quot;</span>: <span class="stringliteral">&quot;0.0000 EOS&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;unstaking_balance&quot;</span>: <span class="stringliteral">&quot;0.0000 EOS&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;last_unstaking_time&quot;</span>: <span class="stringliteral">&quot;1969-12-31T23:59:59&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;permissions&quot;</span>: []</div><div class="line">}</div></div><!-- fragment --><p>Since we have the private key of the genesis accounts (i.e. inita, initb, initc, etc) in the wallet. We can fund our <code>tester</code> account via <code>eosc</code> through any of the genesis account with the following command:</p>
<div class="fragment"><div class="line">$ ./eosc transfer inita tester 1000</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;transaction_id&quot;</span>: <span class="stringliteral">&quot;eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;processed&quot;</span>: {</div><div class="line">    <span class="stringliteral">&quot;refBlockNum&quot;</span>: 2206,</div><div class="line">    <span class="stringliteral">&quot;refBlockPrefix&quot;</span>: 221394282,</div><div class="line">    <span class="stringliteral">&quot;expiration&quot;</span>: <span class="stringliteral">&quot;2017-09-05T08:03:58&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;scope&quot;</span>: [</div><div class="line">      <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;tester&quot;</span></div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;signatures&quot;</span>: [</div><div class="line">      <span class="stringliteral">&quot;1f22e64240e1e479eee6ccbbd79a29f1a6eb6020384b4cca1a958e7c708d3e562009ae6e60afac96f9a3b89d729a50cd5a7b5a7a647540ba1678831bf970e83312&quot;</span></div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;messages&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;code&quot;</span>: <span class="stringliteral">&quot;eos&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;transfer&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;authorization&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;account&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;permission&quot;</span>: <span class="stringliteral">&quot;active&quot;</span></div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;data&quot;</span>: {</div><div class="line">          <span class="stringliteral">&quot;from&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">          <span class="stringliteral">&quot;to&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">          <span class="stringliteral">&quot;amount&quot;</span>: 1000,</div><div class="line">          <span class="stringliteral">&quot;memo&quot;</span>: <span class="stringliteral">&quot;&quot;</span></div><div class="line">        },</div><div class="line">        <span class="stringliteral">&quot;hex_data&quot;</span>: <span class="stringliteral">&quot;000000008040934b00000000c84267a1e80300000000000000&quot;</span></div><div class="line">      }</div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;output&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;notify&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;output&quot;</span>: {</div><div class="line">              <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">            }</div><div class="line">          },{</div><div class="line">            <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;output&quot;</span>: {</div><div class="line">              <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">            }</div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">        <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">      }</div><div class="line">    ]</div><div class="line">  }</div><div class="line">}</div></div><!-- fragment --><p>Now we can verify that the funds were received.</p>
<div class="fragment"><div class="line">$ ./eosc <span class="keyword">get</span> account tester</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;eos_balance&quot;</span>: <span class="stringliteral">&quot;0.1000 EOS&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;staked_balance&quot;</span>: <span class="stringliteral">&quot;0.0001 EOS&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;unstaking_balance&quot;</span>: <span class="stringliteral">&quot;0.0000 EOS&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;last_unstaking_time&quot;</span>: <span class="stringliteral">&quot;1969-12-31T23:59:59&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;permissions&quot;</span>: [{</div><div class="line">      <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;active&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;parent&quot;</span>: <span class="stringliteral">&quot;owner&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;required_auth&quot;</span>: {</div><div class="line">        <span class="stringliteral">&quot;threshold&quot;</span>: 1,</div><div class="line">        <span class="stringliteral">&quot;keys&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;key&quot;</span>: <span class="stringliteral">&quot;EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;weight&quot;</span>: 1</div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;accounts&quot;</span>: []</div><div class="line">      }</div><div class="line">    },{</div><div class="line">      <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;owner&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;parent&quot;</span>: <span class="stringliteral">&quot;owner&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;required_auth&quot;</span>: {</div><div class="line">        <span class="stringliteral">&quot;threshold&quot;</span>: 1,</div><div class="line">        <span class="stringliteral">&quot;keys&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;key&quot;</span>: <span class="stringliteral">&quot;EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;weight&quot;</span>: 1</div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;accounts&quot;</span>: []</div><div class="line">      }</div><div class="line">    }</div><div class="line">  ]</div><div class="line">}</div></div><!-- fragment --><h1><a class="anchor" id="gettingtransaction"></a>
Getting Transaction</h1>
<p>With account_history_api_plugin loaded in <code>eosd</code>, we can query for particular transaction </p><div class="fragment"><div class="line">$ ./eosc <span class="keyword">get</span> transaction eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;transaction_id&quot;</span>: <span class="stringliteral">&quot;eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;processed&quot;</span>: {</div><div class="line">    <span class="stringliteral">&quot;refBlockNum&quot;</span>: 2206,</div><div class="line">    <span class="stringliteral">&quot;refBlockPrefix&quot;</span>: 221394282,</div><div class="line">    <span class="stringliteral">&quot;expiration&quot;</span>: <span class="stringliteral">&quot;2017-09-05T08:03:58&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;scope&quot;</span>: [</div><div class="line">      <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;tester&quot;</span></div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;signatures&quot;</span>: [</div><div class="line">      <span class="stringliteral">&quot;1f22e64240e1e479eee6ccbbd79a29f1a6eb6020384b4cca1a958e7c708d3e562009ae6e60afac96f9a3b89d729a50cd5a7b5a7a647540ba1678831bf970e83312&quot;</span></div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;messages&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;code&quot;</span>: <span class="stringliteral">&quot;eos&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;transfer&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;authorization&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;account&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;permission&quot;</span>: <span class="stringliteral">&quot;active&quot;</span></div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;data&quot;</span>: {</div><div class="line">          <span class="stringliteral">&quot;from&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">          <span class="stringliteral">&quot;to&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">          <span class="stringliteral">&quot;amount&quot;</span>: 1000,</div><div class="line">          <span class="stringliteral">&quot;memo&quot;</span>: <span class="stringliteral">&quot;&quot;</span></div><div class="line">        },</div><div class="line">        <span class="stringliteral">&quot;hex_data&quot;</span>: <span class="stringliteral">&quot;000000008040934b00000000c84267a1e80300000000000000&quot;</span></div><div class="line">      }</div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;output&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;notify&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;output&quot;</span>: {</div><div class="line">              <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">            }</div><div class="line">          },{</div><div class="line">            <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;output&quot;</span>: {</div><div class="line">              <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">            }</div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">        <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">      }</div><div class="line">    ]</div><div class="line">  }</div><div class="line">}</div></div><!-- fragment --><p> Also we can query list of transactions performed by certain account starting from recent one </p><div class="fragment"><div class="line">$ ./eosc <span class="keyword">get</span> transactions inita</div><div class="line">[</div><div class="line">  {</div><div class="line">    <span class="stringliteral">&quot;transaction_id&quot;</span>: <span class="stringliteral">&quot;eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703&quot;</span>,</div><div class="line">    ...</div><div class="line">  },</div><div class="line">  {</div><div class="line">    <span class="stringliteral">&quot;transaction_id&quot;</span>: <span class="stringliteral">&quot;6acd2ece68c4b86c1fa209c3989235063384020781f2c67bbb80bc8d540ca120&quot;</span>,</div><div class="line">    ...</div><div class="line">  },</div><div class="line">  ...</div><div class="line">]</div></div><!-- fragment --><h1><a class="anchor" id="createcontract"></a>
Creating a Contract</h1>
<p>In this section we will use <code>eosc</code> to create and publish a currency contract. You can find the example currency contract in the <code>eos/contracts/currency</code> directory.</p>
<p>The first step is to create an account for currency. We will have the <code>inita</code> account create the <code>currency</code> account. Ensure you have inita private key imported.</p>
<div class="fragment"><div class="line">$ ./eosc create account inita <a class="code" href="namespacecurrency.html">currency</a> EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA</div></div><!-- fragment --><p>The next step is to publish the contract (.wast) and its abi (.abi).</p>
<p>We will need currency active key in our wallet for this </p><div class="fragment"><div class="line">$ ./eosc <span class="keyword">import</span> 5Hv22aPcjnENBv6X9o9nKGdkfrW44En6z4zJUt2PobAvbQXrT9z</div><div class="line">imported <span class="keyword">private</span> key <span class="keywordflow">for</span>: EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA</div></div><!-- fragment --><p> Then proceed with setting the code</p>
<div class="fragment"><div class="line">$ ./eosc <span class="keyword">set</span> contract <a class="code" href="namespacecurrency.html">currency</a> ../../../contracts/<a class="code" href="namespacecurrency.html">currency</a>/<a class="code" href="namespacecurrency.html">currency</a>.wast ../../../contracts/<a class="code" href="namespacecurrency.html">currency</a>/<a class="code" href="namespacecurrency.html">currency</a>.abi</div><div class="line">Reading WAST...</div><div class="line">Assembling WASM...</div><div class="line">Publishing contract...</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;transaction_id&quot;</span>: <span class="stringliteral">&quot;9990306e13f630a9c5436a5a0b6fb8fe2c7f3da2f342b4898a39c4a2c17dcdb3&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;processed&quot;</span>: {</div><div class="line">    <span class="stringliteral">&quot;refBlockNum&quot;</span>: 1208,</div><div class="line">    <span class="stringliteral">&quot;refBlockPrefix&quot;</span>: 3058534156,</div><div class="line">    <span class="stringliteral">&quot;expiration&quot;</span>: <span class="stringliteral">&quot;2017-08-24T18:29:52&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;scope&quot;</span>: [</div><div class="line">      <span class="stringliteral">&quot;currency&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;eos&quot;</span></div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;signatures&quot;</span>: [],</div><div class="line">    <span class="stringliteral">&quot;messages&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;code&quot;</span>: <span class="stringliteral">&quot;eos&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;setcode&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;authorization&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;account&quot;</span>: <span class="stringliteral">&quot;currency&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;permission&quot;</span>: <span class="stringliteral">&quot;active&quot;</span></div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;data&quot;</span>: <span class="stringliteral">&quot;00000079b822651d0000e8150061736d0100000001390a60017e0060037e7e7f017f60047e7e7f7f017f60017f0060057e7e7e7f7f017f60027f7f0060027f7f017f60027e7f0060000060027e7e00029d010a03656e7606617373657274000503656e76086c6f61645f693634000403656e76067072696e7469000003656e76067072696e746e000003656e76067072696e7473000303656e760b726561644d657373616765000603656e760a72656d6f76655f693634000103656e760b7265717569726541757468000003656e760d726571756972654e6f74696365000003656e760973746f72655f6936340002030706000007030809040401700000050301000107cc0107066d656d6f72790200205f5a4e33656f733133726571756972654e6f74696365454e535f344e616d6545000a1e5f5a4e33656f7331317265717569726541757468454e535f344e616d6545000b345f5a4e3863757272656e6379313273746f72654163636f756e74454e33656f73344e616d6545524b4e535f374163636f756e7445000c355f5a4e3863757272656e637932336170706c795f63757272656e63795f7472616e7366657245524b4e535f385472616e7366657245000d04696e6974000e056170706c79000f0a9d0d060600200010080b0600200010070b3400024020012903084200510d0020004280808080a8d7bee3082001411010091a0f0b20004280808080a8d7bee308200110061a0b8a0604017e027f047e017f4100410028020441206b2208360204200029030821052000290300210720002903102104411010042004100241c000100442808080c887d7c8b21d100341d00010042007100341e000100420051003200029030021052000290308100820051008200029030010072000290300210142002105423b210441f00021034200210603400240024002400240024020054206560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b420021052008420037031820082006370310200142808080c887d7c8b21d4280808080a8d7bee308200841106a411010011a200041086a2903002101423b210441f00021034200210603400240024002400240024020054206560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b2008200637030020084200370308200142808080c887d7c8b21d4280808080a8d7bee3082008411010011a200841186a2203290300200041106a22022903005a418001100020032003290300200229030022057d370300200520082903087c20055a41b00110002008200829030820022903007c370308200029030021050240024020032903004200510d0020054280808080a8d7bee308200841106a411010091a0c010b20054280808080a8d7bee308200841106a10061a0b200041086a290300210502400240200841086a2903004200510d0020054280808080a8d7bee3082008411010091a0c010b20054280808080a8d7bee308200810061a0b4100200841206a3602040b980303027f057e017f4100410028020441106b220736020442002103423b210241e00121014200210403400240024002400240024020034207560d0020012c00002200419f7f6a41ff017141194b0d01200041a0016a21000c020b420021052003420b580d020c030b200041ea016a41002000414f6a41ff01714105491b21000b2000ad42388642388721050b2005421f83200242ffffffff0f838621050b200141016a2101200342017c2103200520048421042002427b7c2202427a520d000b42002103423b210241f00021014200210603400240024002400240024020034206560d0020012c00002200419f7f6a41ff017141194b0d01200041a0016a21000c020b420021052003420b580d020c030b200041ea016a41002000414f6a41ff01714105491b21000b2000ad42388642388721050b2005421f83200242ffffffff0f838621050b200141016a2101200342017c2103200520068421062002427b7c2202427a520d000b2007428094ebdc033703082007200637030020044280808080a8d7bee3082007411010091a4100200741106a3602040bb10303027f047e017f4100410028020441206b220836020442002105423b210441e00121034200210603400240024002400240024020054207560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b024020062000520d0042002105423b210441f00121034200210603400240024002400240024020054207560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b20062001520d00200842003703102008420037030820084200370318200841086a4118100541174b4180021000200841086a100d0b4100200841206a3602040b0bff010b0041040b04200500000041100b2254686973206170706561727320746f2062652061207472616e73666572206f6620000041c0000b0220000041d0000b072066726f6d20000041e0000b0520746f20000041f0000b086163636f756e7400004180010b2c696e746567657220756e646572666c6f77207375627472616374696e6720746f6b656e2062616c616e6365000041b0010b26696e7465676572206f766572666c6f7720616464696e6720746f6b656e2062616c616e6365000041e0010b0963757272656e6379000041f0010b097472616e7366657200004180020b1e6d6573736167652073686f72746572207468616e2065787065637465640000fd02046e616d651006617373657274020000086c6f61645f693634050000000000067072696e74690100067072696e746e0100067072696e747301000b726561644d6573736167650200000a72656d6f76655f693634030000000b726571756972654175746801000d726571756972654e6f7469636501000973746f72655f6936340400000000205f5a4e33656f733133726571756972654e6f74696365454e535f344e616d65450101301e5f5a4e33656f7331317265717569726541757468454e535f344e616d6545010130345f5a4e3863757272656e6379313273746f72654163636f756e74454e33656f73344e616d6545524b4e535f374163636f756e74450201300131355f5a4e3863757272656e637932336170706c795f63757272656e63795f7472616e7366657245524b4e535f385472616e73666572450901300131013201330134013501360137013804696e69740801300131013201330134013501360137056170706c7909013001310132013301340135013601370138010b4163636f756e744e616d65044e616d6502087472616e7366657200030466726f6d0b4163636f756e744e616d6502746f0b4163636f756e744e616d65087175616e746974790655496e743634076163636f756e740002036b65790655496e7436340762616c616e63650655496e74363401000000b298e982a4087472616e736665720100000080bafac608076163636f756e74&quot;</span></div><div class="line">      }</div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;output&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">        <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">        <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">      }</div><div class="line">    ]</div><div class="line">  }</div><div class="line">}</div></div><!-- fragment --><h1><a class="anchor" id="pushmessage"></a>
Pushing Message to Contract</h1>
<p>After the contract is published it initially allocates all of the currency to the <code>currency</code> account. So lets transfer some of it to our tester.</p>
<p>We can query the blockchain for the .abi of the contract, on which we can check the list of available actions and their respective message structure </p><div class="fragment"><div class="line">$ ./eosc <span class="keyword">get</span> code --a <a class="code" href="namespacecurrency.html">currency</a>.abi <a class="code" href="namespacecurrency.html">currency</a></div><div class="line">code hash: 9b9db1a7940503a88535517049e64467a6e8f4e9e03af15e9968ec89dd794975</div><div class="line">saving abi to <a class="code" href="namespacecurrency.html">currency</a>.abi</div><div class="line">$ cat <a class="code" href="namespacecurrency.html">currency</a>.abi</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;types&quot;</span>: [{</div><div class="line">      <span class="stringliteral">&quot;newTypeName&quot;</span>: <span class="stringliteral">&quot;AccountName&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;Name&quot;</span></div><div class="line">    }</div><div class="line">  ],</div><div class="line">  <span class="stringliteral">&quot;structs&quot;</span>: [{</div><div class="line">      <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;transfer&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;base&quot;</span>: <span class="stringliteral">&quot;&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;fields&quot;</span>: {</div><div class="line">        <span class="stringliteral">&quot;from&quot;</span>: <span class="stringliteral">&quot;AccountName&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;to&quot;</span>: <span class="stringliteral">&quot;AccountName&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;amount&quot;</span>: <span class="stringliteral">&quot;UInt64&quot;</span></div><div class="line">      }</div><div class="line">    },{</div><div class="line">      <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;account&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;base&quot;</span>: <span class="stringliteral">&quot;&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;fields&quot;</span>: {</div><div class="line">        <span class="stringliteral">&quot;account&quot;</span>: <span class="stringliteral">&quot;Name&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;balance&quot;</span>: <span class="stringliteral">&quot;UInt64&quot;</span></div><div class="line">      }</div><div class="line">    }</div><div class="line">  ],</div><div class="line">  <span class="stringliteral">&quot;actions&quot;</span>: [{</div><div class="line">      <span class="stringliteral">&quot;action&quot;</span>: <span class="stringliteral">&quot;transfer&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;transfer&quot;</span></div><div class="line">    }</div><div class="line">  ],</div><div class="line">  <span class="stringliteral">&quot;tables&quot;</span>: [{</div><div class="line">      <span class="stringliteral">&quot;table&quot;</span>: <span class="stringliteral">&quot;account&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;indextype&quot;</span>: <span class="stringliteral">&quot;i64&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;keynames&quot;</span>: [</div><div class="line">        <span class="stringliteral">&quot;account&quot;</span></div><div class="line">      ],</div><div class="line">      <span class="stringliteral">&quot;keytype&quot;</span>: [],</div><div class="line">      <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;account&quot;</span></div><div class="line">    }</div><div class="line">  ]</div><div class="line">}</div></div><!-- fragment --><p>From the above abi, we can see that <code>currency</code> contract accepts an action called <code>transfer</code> that accepts message with fields <code>from</code>, <code>to</code>, and <code>amount</code>.</p>
<div class="fragment"><div class="line">$ ./eosc push message <a class="code" href="namespacecurrency.html">currency</a> transfer <span class="stringliteral">&#39;{&quot;from&quot;:&quot;currency&quot;,&quot;to&quot;:&quot;tester&quot;,&quot;amount&quot;:50}&#39;</span> -S <a class="code" href="namespacecurrency.html">currency</a> -S tester -p <a class="code" href="namespacecurrency.html">currency</a>@active</div><div class="line">1589302ms thread-0   main.cpp:271                  operator()           ] Converting argument to binary...</div><div class="line">1589304ms thread-0   main.cpp:290                  operator()           ] Transaction result:</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;transaction_id&quot;</span>: <span class="stringliteral">&quot;1c4911c0b277566dce4217edbbca0f688f7bdef761ed445ff31b31f286720057&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;processed&quot;</span>: {</div><div class="line">    <span class="stringliteral">&quot;refBlockNum&quot;</span>: 1173,</div><div class="line">    <span class="stringliteral">&quot;refBlockPrefix&quot;</span>: 2184027244,</div><div class="line">    <span class="stringliteral">&quot;expiration&quot;</span>: <span class="stringliteral">&quot;2017-08-24T18:28:07&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;scope&quot;</span>: [</div><div class="line">      <span class="stringliteral">&quot;currency&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;tester&quot;</span></div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;signatures&quot;</span>: [],</div><div class="line">    <span class="stringliteral">&quot;messages&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;code&quot;</span>: <span class="stringliteral">&quot;currency&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;transfer&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;authorization&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;account&quot;</span>: <span class="stringliteral">&quot;currency&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;permission&quot;</span>: <span class="stringliteral">&quot;active&quot;</span></div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;data&quot;</span>: {</div><div class="line">          <span class="stringliteral">&quot;from&quot;</span>: <span class="stringliteral">&quot;currency&quot;</span>,</div><div class="line">          <span class="stringliteral">&quot;to&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">          <span class="stringliteral">&quot;quantity&quot;</span>: 50</div><div class="line">        },</div><div class="line">        <span class="stringliteral">&quot;hex_data&quot;</span>: <span class="stringliteral">&quot;00000079b822651d00000000c84267a13200000000000000&quot;</span></div><div class="line">      }</div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;output&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;notify&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;output&quot;</span>: {</div><div class="line">              <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">            }</div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">        <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">      }</div><div class="line">    ]</div><div class="line">  }</div><div class="line">}</div></div><!-- fragment --><p>Now we can transfer it from <code>tester</code> to <code>inita</code> and require the permission of <code>tester</code>. This should drain the balance of <code>tester</code> to 0.</p>
<div class="fragment"><div class="line">$ ./eosc push message <a class="code" href="namespacecurrency.html">currency</a> transfer <span class="stringliteral">&#39;{&quot;from&quot;:&quot;tester&quot;,&quot;to&quot;:&quot;inita&quot;,&quot;amount&quot;:50}&#39;</span> -S inita -S tester -p tester@active</div><div class="line">3116153ms thread-0   main.cpp:271                  operator()           ] Converting argument to binary...</div><div class="line">3116154ms thread-0   main.cpp:290                  operator()           ] Transaction result:</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;transaction_id&quot;</span>: <span class="stringliteral">&quot;56b9f0f3b9f43254af446c5dca02a6fcb24ebcdb506d7248947fd4d52a27972a&quot;</span>,</div><div class="line">  <span class="stringliteral">&quot;processed&quot;</span>: {</div><div class="line">    <span class="stringliteral">&quot;refBlockNum&quot;</span>: 2882,</div><div class="line">    <span class="stringliteral">&quot;refBlockPrefix&quot;</span>: 1880685856,</div><div class="line">    <span class="stringliteral">&quot;expiration&quot;</span>: <span class="stringliteral">&quot;2017-08-24T19:53:34&quot;</span>,</div><div class="line">    <span class="stringliteral">&quot;scope&quot;</span>: [</div><div class="line">      <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;tester&quot;</span></div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;signatures&quot;</span>: [],</div><div class="line">    <span class="stringliteral">&quot;messages&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;code&quot;</span>: <span class="stringliteral">&quot;currency&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;type&quot;</span>: <span class="stringliteral">&quot;transfer&quot;</span>,</div><div class="line">        <span class="stringliteral">&quot;authorization&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;account&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;permission&quot;</span>: <span class="stringliteral">&quot;active&quot;</span></div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;data&quot;</span>: {</div><div class="line">          <span class="stringliteral">&quot;from&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">          <span class="stringliteral">&quot;to&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">          <span class="stringliteral">&quot;quantity&quot;</span>: 50</div><div class="line">        },</div><div class="line">        <span class="stringliteral">&quot;hex_data&quot;</span>: <span class="stringliteral">&quot;00000000c84267a1000000008040934b3200000000000000&quot;</span></div><div class="line">      }</div><div class="line">    ],</div><div class="line">    <span class="stringliteral">&quot;output&quot;</span>: [{</div><div class="line">        <span class="stringliteral">&quot;notify&quot;</span>: [{</div><div class="line">            <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;inita&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;output&quot;</span>: {</div><div class="line">              <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">            }</div><div class="line">          },{</div><div class="line">            <span class="stringliteral">&quot;name&quot;</span>: <span class="stringliteral">&quot;tester&quot;</span>,</div><div class="line">            <span class="stringliteral">&quot;output&quot;</span>: {</div><div class="line">              <span class="stringliteral">&quot;notify&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">              <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">            }</div><div class="line">          }</div><div class="line">        ],</div><div class="line">        <span class="stringliteral">&quot;sync_transactions&quot;</span>: [],</div><div class="line">        <span class="stringliteral">&quot;async_transactions&quot;</span>: []</div><div class="line">      }</div><div class="line">    ]</div><div class="line">  }</div><div class="line">}</div></div><!-- fragment --><p>Now that <code>tester</code> has a balance of 0, if we attempt this transfer a second time it should fail:</p>
<div class="fragment"><div class="line">$ ./eosc push message <a class="code" href="namespacecurrency.html">currency</a> transfer <span class="stringliteral">&#39;{&quot;from&quot;:&quot;tester&quot;,&quot;to&quot;:&quot;inita&quot;,&quot;amount&quot;:50}&#39;</span> -S inita -S tester -p tester@active</div><div class="line">3543610ms thread-0   main.cpp:271                  operator()           ] Converting argument to binary...</div><div class="line">3543615ms thread-0   main.cpp:311                  main                 ] Failed with error: 10 assert_exception: Assert Exception</div><div class="line">status_code == 200: Error</div><div class="line">: 10 assert_exception: Assert Exception</div><div class="line">test: assertion failed: integer underflow subtracting token balance</div><div class="line">    {<span class="stringliteral">&quot;s&quot;</span>:<span class="stringliteral">&quot;integer underflow subtracting token balance&quot;</span>,<span class="stringliteral">&quot;ptr&quot;</span>:176}</div><div class="line">    thread-1  wasm_interface.cpp:248 assertnonei32i32</div><div class="line"></div><div class="line">[...snipped...]</div></div><!-- fragment --><h1><a class="anchor" id="querycontract"></a>
Querying Contract</h1>
<p>After doing the transfer action on <code>currency</code> contract, we can verify the amount of token held by each account by looking at <code>currency</code>'s <code>account</code> table.</p>
<p>This table is stored on the scope of each account instead of on <code>currency</code> scope.</p>
<div class="fragment"><div class="line">$./eosc <span class="keyword">get</span> table tester <a class="code" href="namespacecurrency.html">currency</a> account</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;rows&quot;</span>: [],</div><div class="line">  <span class="stringliteral">&quot;more&quot;</span>: <span class="keyword">false</span></div><div class="line">}</div><div class="line">$./eosc <span class="keyword">get</span> table inita <a class="code" href="namespacecurrency.html">currency</a> account</div><div class="line">{</div><div class="line">  <span class="stringliteral">&quot;rows&quot;</span>: [{</div><div class="line">      <span class="stringliteral">&quot;account&quot;</span>: <span class="stringliteral">&quot;account&quot;</span>,</div><div class="line">      <span class="stringliteral">&quot;balance&quot;</span>: 50</div><div class="line">    }</div><div class="line">  ],</div><div class="line">  <span class="stringliteral">&quot;more&quot;</span>: <span class="keyword">true</span></div><div class="line">}</div></div><!-- fragment --><h1><a class="anchor" id="particularnode"></a>
Connecting to Particular Node</h1>
<p>By default, <code>eosc</code> will connect to <code>eosd</code> running on localhost port 8888. You can connect to another <code>eosd</code> node by specifying its host and port. </p><div class="fragment"><div class="line">./eosc -H localhost -p 8889</div></div><!-- fragment --><h1><a class="anchor" id="separatewallet"></a>
Using Separate Wallet App</h1>
<p>Instead of using the wallet functionality built-in to <code>eosd</code>, you can also use a separate wallet app which can be found inside programs/eos-walletd. By default, port 8888 is used by <code>eosd</code>, so choose another port for the wallet app. </p><div class="fragment"><div class="line">./<a class="code" href="namespaceeos.html">eos</a>-walletd --http-server-endpoint 127.0.0.1:8887</div></div><!-- fragment --><p> Then for any operation that requires signing, use the &ndash;wallet-host and &ndash;wallet-port option </p><div class="fragment"><div class="line">./eosc --wallet-host 127.0.0.1 --wallet-port 8887 &lt;COMMAND&gt; &lt;SUBCOMMAND&gt; &lt;PARAMS&gt;</div></div><!-- fragment --><h1><a class="anchor" id="skippingsignature"></a>
Skipping Signatures</h1>
<p>As an easy way for developers to test functionality without dealing with keys, <code>eosd</code> can be run so that Transaction signatures are not required. </p><div class="fragment"><div class="line">./eosd --skip-transaction-signatures</div></div><!-- fragment --><p> And then for any operation that requires signing, use the <code>-s</code> option </p><div class="fragment"><div class="line">./eosc &lt;COMMAND&gt; &lt;SUBCOMMAND&gt; -s &lt;PARAMS&gt;</div></div><!-- fragment --><h1><a class="anchor" id="additionaldoc"></a>
Additional Documentation</h1>
<p>eosc contains documentation for all of its commands. For a list of all commands known to eosc, simply run it with no arguments: </p><div class="fragment"><div class="line">$ ./eosc</div><div class="line">ERROR: RequiredError: Subcommand required</div><div class="line">Command Line Interface to Eos Daemon</div><div class="line">Usage: ./eosc [OPTIONS] SUBCOMMAND</div><div class="line"></div><div class="line">Options:</div><div class="line">  -h,--help                   Print <span class="keyword">this</span> help message and exit</div><div class="line">  -H,--host TEXT=localhost    the host where eosd is running</div><div class="line">  -p,--port UINT=8888         the port where eosd is running</div><div class="line">  --wallet-host TEXT=localhost</div><div class="line">                              the host where <a class="code" href="namespaceeos.html">eos</a>-walletd is running</div><div class="line">  --wallet-port UINT=8888     the port where <a class="code" href="namespaceeos.html">eos</a>-walletd is running</div><div class="line"></div><div class="line">Subcommands:</div><div class="line">  create                      Create various items, on and off the blockchain</div><div class="line">  <span class="keyword">get</span>                         Retrieve various items and information from the blockchain</div><div class="line">  <span class="keyword">set</span>                         Set or update blockchain state</div><div class="line">  transfer                    Transfer EOS from account to account</div><div class="line">  wallet                      Interact with local wallet</div><div class="line">  benchmark                   Configure and execute benchmarks</div><div class="line">  push                        Push arbitrary transactions to the blockchain</div></div><!-- fragment --><p> To get help with any particular subcommand, run it with no arguments as well: </p><div class="fragment"><div class="line">$ ./eosc create</div><div class="line">ERROR: RequiredError: Subcommand required</div><div class="line">Create various items, on and off the blockchain</div><div class="line">Usage: ./eosc create SUBCOMMAND</div><div class="line"></div><div class="line">Subcommands:</div><div class="line">  key                         Create a <span class="keyword">new</span> keypair and <a class="code" href="namespaceeos.html#a1df73defa04d39763089df7faa35a934">print</a> the <span class="keyword">public</span> and <span class="keyword">private</span> keys</div><div class="line">  account                     Create a <span class="keyword">new</span> account on the blockchain</div><div class="line">$ ./eosc create account</div><div class="line">ERROR: RequiredError: creator</div><div class="line">Create a <span class="keyword">new</span> account on the blockchain</div><div class="line">Usage: ./eosc create account creator name OwnerKey ActiveKey</div><div class="line"></div><div class="line">Positionals:</div><div class="line">  creator TEXT                The name of the account creating the <span class="keyword">new</span> account</div><div class="line">  name TEXT                   The name of the <span class="keyword">new</span> account</div><div class="line">  OwnerKey TEXT               The owner <span class="keyword">public</span> key <span class="keywordflow">for</span> the account</div><div class="line">  ActiveKey TEXT              The active <span class="keyword">public</span> key <span class="keywordflow">for</span> the account</div></div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
